package com.payment.ktb.application;

import android.app.Application;
import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.payment.ktb.utils.SharedPreferencesUtils;
import com.pgyersdk.crash.PgyCrashManager;
import com.ppdai.loan.PPDLoanAgent;
import com.treefinance.sdk.GFDAgent;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

import static android.provider.UserDictionary.Words.APP_ID;


/**
 * Created by syd on 2016/4/26.
 */
public class MyApplication extends Application {

    private static Context mContext;

    private static MyApplication sInstance;
    private RequestQueue mRequestQueue;
    @Override
    public void onCreate() {
        super.onCreate();

        mContext = getApplicationContext();
        SharedPreferencesUtils.init();
        //功夫贷
        GFDAgent.init(this);
        //拍拍贷
        PPDLoanAgent.getInstance().initApplication(this);
        PgyCrashManager.register(this);
//        Thread.setDefaultUncaughtExceptionHandler(new LocalFileHandler(mContext));


        //Umeng 分享
        PlatformConfig.setWeixin("wxf10a747a553b4625","3ced17b896a1831032df0a68354b7829");
        PlatformConfig.setSinaWeibo("4170893334","cf551ab577ed24a0b1152ec449cb5858 ","http://ktb.4006007909.com/down");
        UMShareAPI.get(this);


        //volley
        sInstance = this;

    }



    public RequestQueue getRequestQueue() {
        // lazy initialize the request queue, the queue instance will be
        // created when it is accessed for the first time
        if (mRequestQueue == null) {
            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
        }

        return mRequestQueue;
    }

    public static synchronized MyApplication getInstance() {
        return sInstance;
    }

    public static  Context getContext(){

        return mContext;
    }

}
